home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / prg_casm / snpd9611.zip / WB_FCOPY.C < prev    next >
Text File  |  1996-11-24  |  1KB  |  48 lines

  1. .I 0 3
  2. /* +++Date last modified: 28-Jul-1996 */
  3.  
  4. /*
  5. .D 1 1
  6. .I 3 1
  7. ** modified by: Bob Stout, Ray Gardner, and David Gersic
  8. .D 4 3
  9. .I 31 1
  10.             return Error_;
  11. .D 32 1
  12. .I 36 21
  13.       if (fdto >= 0)
  14.       {
  15.             if (Success_ == fdcopy(fdfrom, fdto))
  16.             {
  17.                   close(fdto);
  18.                   close(fdfrom);
  19.                   return Success_;
  20.             }
  21.             else
  22.             {
  23.                   close(fdto);
  24.                   remove(to);             /* delete any partial file  */
  25.             }
  26.       }
  27.       close(fdfrom);
  28.       return Error_;
  29. }
  30.  
  31. int fdcopy(int fdfrom, int fdto)
  32. {
  33.       int bufsiz, retval = Error_;
  34. .D 37 2
  35. .I 53 1
  36.                         if (n == -1)            /* if error             */
  37. .D 54 1
  38. .I 55 4
  39.                         if (n == 0)             /* if end of file       */
  40.                         {
  41.                               retval = Success_;
  42.                               break;
  43. .D 56 6
  44. .I 69 2
  45.       return retval;
  46. }
  47. .D 70 5
  48.